package hello.configuration.security;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;

/**
 * @Description:
 * @Author: m01
 * @Date: created at  2018/12/20  10:21
 * @Modified By:
 */
/*@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableWebSecurity*/
public class SecurityConfiguration {//extends WebSecurityConfigurerAdapter {


   /* @Bean
    InMemoryUserDetailsManager userDetailsManager() {

        User.UserBuilder builder = User.withDefaultPasswordEncoder();

        UserDetails greg = builder.username("greg").password("turnquist").roles("USER").build();
        UserDetails ollie = builder.username("ollie").password("gierke").roles("USER", "ADMIN").build();

        return new InMemoryUserDetailsManager(greg, ollie);
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {

        http.httpBasic().and().authorizeRequests().
                antMatchers(HttpMethod.PATCH, "/**").hasRole("ADMIN").and().//
                csrf().disable();

    }*/
}
